//顶部活动栏
var advClose = document.querySelector(".adv>i");
advClose.onclick = function() {
	this.parentNode.style.display = "none";
}

//导航栏固定窗口
var nav_content = document.querySelector(".nav_content");
var nav = document.querySelector(".nav");
var backtop = document.querySelector(".back_top");
document.onscroll = function() {
	var scroll_top = document.documentElement.scrollTop;
	var nav_top = nav_content.offsetTop;
	if (nav_top < scroll_top) {
			nav_content.classList.add("nav_fixed");
		};
		if (scroll_top < nav.offsetTop) {
			nav_content.classList.remove("nav_fixed");
		};
	
	if (scroll_top > 800) {
		backtop.style.display = "block";
	} else {
		backtop.style.display = "none";
	}
}

//回到顶部
backtop.onclick = function() {
	jumpfloor(0);
};
function jumpfloor(offsetTop) {
	var scrollTop = document.documentElement.scrollTop;
	clearInterval(time);
	var time = setInterval(function() {
		scrollTop = scrollTop - (scrollTop - offsetTop) / 5;
		if (Math.abs(scrollTop - offsetTop) < 1) {
			scrollTop = offsetTop;
			clearInterval(time);
		}
		document.documentElement.scrollTop = scrollTop;
	}, 30)
	document.documentElement.scrollTop = scrollTop;
}

